<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%--
  Created by IntelliJ IDEA.
  User: luiza
  Date: 05/09/12
  Time: 00:27
  To change this template use File | Settings | File Templates.
--%>
<%@ include file="/taglibs.jsp" %>

<head>
    <title><fmt:message key="contato.form.title"/></title>
</head>

<p>Por favor, preencha as informacoes do contato abaixo:</p>

<form:form commandName="contato" method="post" action="contatoForm" onsubmit="return validateContato(this)"
           id="contatoForm">
    <form:errors path="*" cssClass="error"/>
    <form:hidden path="id"/>
    <table class="detail">
        <tr>
            <th><label for="gravatarurl">Foto:</label></th>
            <td>
                <img src="${contato.gravatarURL}" id="gravatarurl"/>

            </td>
        </tr>
        <tr>
            <th><label for="nome">* <fmt:message key="contato.nome"/>:</label></th>
            <td>
                <form:input path="nome" id="nome"/>
                <form:errors path="nome" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <th><label for="empresa"> <fmt:message key="contato.empresa"/>:</label></th>
            <td>
                <form:input path="empresa" id="empresa"/>
                <form:errors path="empresa" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <th><label for="telefone"><fmt:message key="contato.telefone"/>:</label></th>
            <td>
                <form:input path="telefone" id="telefone" onblur="validateInteger()"/>
                <form:errors path="telefone" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <th><label for="celular" class="required"><fmt:message key="contato.celular"/>:</label></th>
            <td>
                <form:input path="celular" id="celular" onblur="validateInteger()"/>
                <form:errors path="celular" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <th><label for="email" class="required">* <fmt:message key="contato.email"/>:</label></th>
            <td>
                <form:input path="email" id="email" onblur="validateEmail()"/>
                <form:errors path="email" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <th><label for="facebook">Facebook:</label></th>
            <td>
                <form:input path="facebook" id="facebook"/>
                <form:errors path="facebook" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <th><label for="twitter">Twitter:</label></th>
            <td>
                <form:input path="twitter" id="twitter"/>
                <form:errors path="twitter" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <th><label for="dtAniversario">Data de Aniversario:</label></th>
            <td>
                <form:input path="dtAniversario" id="dtAniversario"/> (dd/MM/YYYY)
                <form:errors path="dtAniversario" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <th><label for="grupo" class="required"><fmt:message key="contato.grupo"/>:</label></th>
            <td>
                <form:select path="grupo" id="grupo">
                    <form:option value="0" label="Selecione"/>
                    <form:options items="${grupoList}" itemValue="id" itemLabel="descricao"/>
                    <form:errors path="grupo" cssClass="fieldError"/>
                </form:select>

            </td>
        </tr>
        <tr>
            <th><label for="observacoes" class="required"><fmt:message key="contato.observacoes"/>:</label></th>
            <td>
                <form:textarea path="observacoes" id="observacoes"/>
                <form:errors path="observacoes" cssClass="fieldError"/>
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <input type="submit" class="button" name="save" value="Salvar"/>
                <c:if test="${not empty param.id}">
                    <input type="submit" class="button" name="delete" value="Excluir"/>
                </c:if>
                <input type="submit" class="button" name="cancel" value="Cancelar" onclick="bCancel=true"/>
            </td>
        </tr>

    </table>
</form:form>

<script type="text/javascript">
    Form.focusFirstElement($('contatoForm'));
    ;
</script>

<v:javascript formName="user" staticJavascript="false" xhtml="true" cdata="false"/>
<script type="text/javascript" src="<c:url value="/scripts/validator.jsp"/>"></script>
